package com.punai.system.domain;

import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.punai.system.bo.LoginUserRes;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.punai.common.annotation.Excel;
import com.punai.common.core.domain.BaseEntity;

/**
 * 工具企业微信登录日志对象 sys_wechatcomlogin_log
 *
 * @author zxw_
 * @date 2023-04-23
 */
public class SysWechatcomloginLog extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** $column.columnComment */
    private String id;
    /** $column.columnComment */
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    @TableField(fill = FieldFill.INSERT)
    private String userId;
    /** $column.columnComment */
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    private String weChatComUserid;
    /** $column.columnComment */
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    private String state;
    /** $column.columnComment */
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    private String isLoginSuccess;
    /** $column.columnComment */
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    private String token;
    /** $column.columnComment */
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    private String loginUserRes;
    /** $column.columnComment */
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    private String macid;
    /** $column.columnComment */
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    private String weChatComCode;
    public void setId(String id)
    {
        this.id = id;
    }

    public String getId()
    {
        return id;
    }
    public void setUserId(String userId)
    {
        this.userId = userId;
    }

    public String getUserId()
    {
        return userId;
    }
    public void setWeChatComUserid(String weChatComUserid)
    {
        this.weChatComUserid = weChatComUserid;
    }

    public String getWeChatComUserid()
    {
        return weChatComUserid;
    }
    public void setState(String state)
    {
        this.state = state;
    }

    public String getState()
    {
        return state;
    }
    public void setLoginSuccess(Boolean isLoginSuccess)
    {
        this.isLoginSuccess = isLoginSuccess ?"1":"0";
    }

    public String getIsLoginSuccess()
    {
        return isLoginSuccess;
    }
    public void setToken(String token)
    {
        this.token = token;
    }

    public String getToken()
    {
        return token;
    }
    public void setLoginUserRes(String loginUserRes)
    {
        this.loginUserRes = loginUserRes;
    }

    public String getLoginUserRes()
    {
        return loginUserRes;
    }
    public void setMacid(String macid)
    {
        this.macid = macid;
    }

    public String getMacid()
    {
        return macid;
    }
    public void setWeChatComCode(String weChatComCode)
    {
        this.weChatComCode = weChatComCode;
    }

    public String getWeChatComCode()
    {
        return weChatComCode;
    }


    public LoginUserRes getLoginUserResObj() {
        return JSONObject.parseObject(this.getLoginUserRes(), LoginUserRes.class);
    }

    public void setLoginUserResObj(LoginUserRes loginUserRes) {
        this.loginUserRes = JSONObject.toJSONString(loginUserRes);
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("userId", getUserId())
            .append("weChatComUserid", getWeChatComUserid())
            .append("state", getState())
            .append("isLoginSuccess", getIsLoginSuccess())
            .append("token", getToken())
            .append("loginUserRes", getLoginUserRes())
            .append("macid", getMacid())
            .append("weChatComCode", getWeChatComCode())
            .append("createBy", getCreateBy())
            .append("updateBy", getUpdateBy())
            .append("createTime", getCreateTime())
            .append("updateTime", getUpdateTime())
        .toString();
    }
}
